home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
ste
/
autoexec.lzh
/
SOURCE
/
COOKIE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-08-05
|
745b
|
37 lines
#include <tos.h>
int get_cookie(long cookie, long *p_value)
/* Returns zero if the 'cookie' is not found in the jar.
* if the cookie is found it returns non zero and places the
* value in the longword pointed to by 'p_value'. If 'p_value'
* is '0l' it does not put the value anywhere...
*/
{void *oldssp;
long *cookiejar;
int ret;
ret = 0;
if (Super((void *)1L) == 0l)
oldssp = (void *)Super((void *)0l);
else
oldssp = 0;
if ((cookiejar = *(long **)0x5A0) != 0l)
{
do
{ if (*cookiejar == cookie)
{ if (p_value != 0l)
*p_value = *(cookiejar + 1);
ret = 1;
break;
}
cookiejar += 2;
} while (*cookiejar != 0);
}
if (oldssp != 0) Super(oldssp);
return ret;
}